/*  ----------------------------------------------------------------------------
 *  Arello Mobile
 *  Fast 3d Engine
 *  ----------------------------------------------------------------------------
 * Except where otherwise noted, this work is licensed under
 * http://creativecommons.org/licenses/by/3.0
 */

#ifndef __LIB3D_HARD_DIRECTX8_POINT_BUFFER_H__
#define __LIB3D_HARD_DIRECTX8_POINT_BUFFER_H__

#include <lib3d/hard/PointBuffer.h>
#include "Dependent.h"
#include <d3d9.h>

namespace liba
{
namespace lib3d
{
namespace hard
{
namespace directx8
{
class Hardware;

class PointBuffer : public hard::PointBuffer, public Dependent
{
	IDirect3DVertexBuffer9 * vertex_buffer;
	int vertices_count;
	int allocated_count;
	bool valid_flag;
	bool world_size;
	int stride;

//	IDirect3DVertexShader9 * VertexShader;
//	IDirect3DVertexShader9 * VertexShaderScreen;
//	IDirect3DVertexDeclaration9 * ShaderDeclaration;
public:
	explicit PointBuffer(Hardware * hardware);
	virtual ~PointBuffer();
	virtual bool is_valid()const;
	virtual bool update(
		const float * positions, int positions_count,
		const float * diffuse_colors, int diffuse_colors_count,
		const float * sizes, int sizes_count );
	virtual void render( int vertex_pos, int primitive_count );

	virtual void invalidate();
	virtual void release();
};

} // namespace directx8
} // namespace hard
} // namespace lib3d
} // namespace liba
using namespace liba;

#endif //__LIB3D_HARD_DIRECTX8_POINT_BUFFER_H__